import turtle
import math

def draw_beautiful_flower():
    # 设置画布
    window = turtle.Screen()
    window.bgcolor("#F0F8FF")  # 淡蓝色背景
    window.title("精美的黄色花朵")
    
    # 创建画笔
    pen = turtle.Turtle()
    pen.speed(0)  # 最快速度
    pen.hideturtle()
    
    # 定义颜色
    petal_colors = ["#FFEB3B", "#FFD700", "#FFC107", "#FFA000"]  # 黄色渐变
    center_color = "#FF5722"  # 深橙色
    stem_color = "#2E7D32"    # 深绿色
    leaf_color = "#4CAF50"    # 绿色
    
    # 绘制花茎
    pen.color(stem_color)
    pen.pensize(4)
    pen.begin_fill()
    pen.left(90)
    pen.forward(250)
    pen.right(150)
    pen.forward(60)
    pen.left(120)
    pen.forward(60)
    pen.end_fill()
    
    # 绘制叶子
    def draw_leaf(size):
        pen.color(leaf_color)
        pen.begin_fill()
        pen.left(120)
        pen.forward(size)
        pen.right(120)
        pen.forward(size/2)
        pen.right(120)
        pen.forward(size)
        pen.end_fill()
    
    # 绘制左侧叶子
    draw_leaf(70)
    
    # 移动到右侧绘制另一片叶子
    pen.penup()
    pen.left(180)
    pen.forward(35)
    pen.right(150)
    pen.forward(150)
    pen.right(90)
    pen.pendown()
    
    # 绘制右侧叶子
    draw_leaf(50)
    
    # 回到花茎顶部
    pen.penup()
    pen.left(180)
    pen.forward(25)
    pen.right(150)
    pen.forward(150)
    pen.right(90)
    pen.pendown()
    
    # 绘制花瓣
    def draw_petal(size, color):
        pen.color(color)
        pen.begin_fill()
        
        # 绘制一个更自然的花瓣形状
        for _ in range(2):
            pen.circle(size, 60)
            pen.circle(size/3, 120)
        
        pen.end_fill()
    
    # 绘制外层花瓣
    for i in range(12):
        color_index = i % len(petal_colors)
        draw_petal(60, petal_colors[color_index])
        pen.right(30)
    
    # 绘制内层花瓣
    pen.penup()
    pen.right(90)
    pen.forward(20)
    pen.left(90)
    pen.pendown()
    
    for i in range(8):
        color_index = (i + 2) % len(petal_colors)
        draw_petal(40, petal_colors[color_index])
        pen.right(45)
    
    # 绘制花心
    pen.penup()
    pen.right(90)
    pen.forward(15)
    pen.left(90)
    pen.pendown()
    
    # 绘制渐变花心
    for radius in range(25, 0, -5):
        # 从深橙色渐变到浅橙色
        intensity = 1 - (radius / 25)
        color = (1.0, 0.3 + intensity * 0.4, 0.1)
        pen.color(color)
        pen.begin_fill()
        pen.circle(radius)
        pen.end_fill()
    
    # 在花心中心添加亮点
    pen.penup()
    pen.left(90)
    pen.forward(5)
    pen.right(90)
    pen.pendown()
    
    pen.color("white")
    pen.begin_fill()
    pen.circle(3)
    pen.end_fill()
    
    # 添加文字说明
    pen.penup()
    pen.right(90)
    pen.forward(300)
    pen.left(90)
    pen.color("#333333")
    pen.write("黄色花朵", font=("Arial", 20, "bold"))
    pen.pendown()
    
    # 完成绘制
    turtle.done()

if __name__ == "__main__":
    draw_beautiful_flower()
